package com.bwhx.eruler.dao.casdilly.impl;

import java.util.HashMap;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.bwhx.eruler.bean.Page;
import com.bwhx.eruler.bean.casdilly.Contract;
import com.bwhx.eruler.bean.casdilly.FenchangStatus;
import com.bwhx.eruler.bean.casdilly.Linkman;
import com.bwhx.eruler.dao.casdilly.LinkmanDAO;
import com.bwhx.eruler.dao.impl.BaseDaoImpl;
@Repository
public class LinkmanDAOImpl extends BaseDaoImpl<Linkman> implements LinkmanDAO{
	
	public LinkmanDAOImpl() {
		this.setNs("com.bwhx.eruler.mapper.casdilly.LinkmanMapper.");
	}

	
	@Override
	public List<Linkman> findByContractSerial(String cPIDSerial) {
		return getSqlSession().selectList(this.getNs() + "findByContractSerial", cPIDSerial);
	}


	@Override
	public List<Linkman> list(Page p) {
		return getSqlSession().selectList(this.getNs() + "list", p);
	}


	@Override
	public Integer count(Linkman linkman) {
		return getSqlSession().selectOne(this.getNs() + "count", linkman);
	}


	@Override
	public List<Linkman> findByContractSerialAndCreatorID(String cPIDSerial, String creatorID,Integer start) {
		
		HashMap<String,Object> paramMap = new HashMap<String,Object>();
		paramMap.put("cPIDSerial", cPIDSerial);
		paramMap.put("creatorID", creatorID);
		paramMap.put("start", start);
		return getSqlSession().selectList(this.getNs() + "findByContractSerialAndCreatorID", paramMap);
	}


	@Override
	public List<FenchangStatus> linkmanStatusList(Page p) {
 		return getSqlSession().selectList(this.getNs() + "linkmanStatusList", p);
	}


	@Override
	public Integer linkmanStatusCount(Linkman linkman) {
 		return getSqlSession().selectOne(this.getNs() + "linkmanStatusCount", linkman);
	}


	@Override
	public List<Linkman> findByNameAndContractSerial(Linkman lm) {
		return getSqlSession().selectList(this.getNs() + "findByNameAndContractSerial", lm);
	}


	@Override
	public void updateDelFlagByContract(Contract contract) {
		 getSqlSession().update (this.getNs() + "updateDelFlagByContract", contract);
		
		 
 		
	}


	@Override
	public List<Linkman> listByContract(Contract contract) {
		return getSqlSession().selectList(this.getNs() + "listByContract", contract);
	}


	

}
